import 'package:flutter/material.dart';
import 'package:provide/provide.dart';
import '../../provide/detailsDats.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';


class DetailsTabbar extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Provide<DetailsInfoProvide>(
      builder: (context,child,val){
        var isLeft =  Provide.value<DetailsInfoProvide>(context).isLeft;
        var isRight =  Provide.value<DetailsInfoProvide>(context).isRight;

        return Container(
          margin: EdgeInsets.only(top: 15),
          child: Row(
            children: <Widget>[
            _details(context,isLeft),
            _comment(context,isRight)
            ],
          ),
        );
      },
    );
  }
  //评论按钮
  Widget _details(BuildContext context,bool isLeft){
    return InkWell(
      onTap: (){
        Provide.value<DetailsInfoProvide>(context).changeLeftAndRight('left');
      },
      child: Container(
        padding:EdgeInsets.all(10),
        alignment: Alignment.center,
        width: ScreenUtil().setWidth(375),
        decoration: BoxDecoration(
          color: Colors.white,
          border: Border(
            bottom: BorderSide(width: 1.0,color: isLeft?Colors.red:Colors.black12)
          )
        ),
        child: Text(
          "商品详情",
          style:TextStyle(
            color:isLeft?Colors.red:Colors.black
          )
        ),
      ),
    );
  }
  Widget _comment(BuildContext context,bool isRight){
    return InkWell(
      onTap: (){
        // print('111111111111111111111111111111111111111111111');
        Provide.value<DetailsInfoProvide>(context).changeLeftAndRight('right');
      },
      child: Container(
        padding:EdgeInsets.all(10),
        alignment: Alignment.center,
        width: ScreenUtil().setWidth(375),
        decoration: BoxDecoration(
          color: Colors.white,
          border: Border(
            bottom: BorderSide(width: 1.0,color: isRight?Colors.red:Colors.black12)
          )
        ),
        child: Text(
          "商品评论",
          style:TextStyle(
            color:isRight?Colors.red:Colors.black
          )
        ),
      ),
    );
  }

}